<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link href="${pageContext.request.contextPath}/static/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/layer/layer.js"></script>
</head>
<body>
<div class="container">
    <form class="form-horizontal"  id="form1">
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">姓名</label>
            <div class="col-sm-10">
                <input type="email" class="form-control" id="name" placeholder="姓名" name="name" value="${emp.name}">
                <input type="hidden" name="id" value="${emp.id}">
            </div>
        </div>
        <div class="form-group">
            <label for="personNumber" class="col-sm-2 control-label">身份证</label>
            <div class="col-sm-10">
                <input type="email" class="form-control" id="personNumber" placeholder="身份证号码"  name="personNumber"  value="${emp.personNumber}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">性别</label>
            <div class="col-sm-10">
                <label class="radio-inline">

                    <input type="radio" name="sex" id="sexA" value="1"
                    <c:if test="${emp.sex=='男'}">checked</c:if>
                    > 男
                </label>
                <label class="radio-inline">
                    <input type="radio" name="sex" id="sexB" value="0"
                           <c:if test="${emp.sex=='女'}">checked</c:if>
                    > 女
                </label>
            </div>
        </div>


        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="button" class="btn btn-info" id="btn_submit">提交</button>
                <button type="button" class="btn btn-default" id="btn_quxiao">取消</button>
            </div>
        </div>
    </form>
</div>

</body>
<script>
    $(function () {
        $("#btn_submit").click(function () {
            var serialize = $("#form1").serialize();
            // alert(serialize);
           $.post("/submitEmpEdit",serialize,function (json) {
                if(json.success){
                    layer.msg("操作成功",{time:1000},function () {
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    });
                }
            },"json");
        });

        $("#btn_quxiao").click(function () {
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index); //再执行关闭
        });
    })
</script>
</html>
